from tkinter import Tk
from tkinter import Menu
import tkinter as tk

from database.purchase_function_admin.addpurchase import AddPurchase
from database.purchase_function_admin.admendpurchase import AdmendPurchase
from database.purchase_function_admin.countpurchase import CountPurchase
from database.purchase_function_admin.deletepurchase import DeletePurchase
from database.purchase_function_admin.searchpurchase import SearchPurchase

def PurchasePage():  #采购信息
    admin_purchase_screen = Tk()
    admin_purchase_screen.title('采购信息管理')
    screen_width, screen_height = admin_purchase_screen.maxsize()
    # 窗口的宽和高
    width = 410
    height = 140
    centre = '%dx%d+%d+%d' % (width, height, (screen_width - width) / 2,
                              (screen_height - height) / 2)
    admin_purchase_screen.geometry(centre)
    welcome = tk.Label(admin_purchase_screen, text='请选择功能！', font=('楷体', 20))
    welcome.place(x=120, y=40)

    def add():
        AddPurchase()

    def amend():
        AdmendPurchase()

    def search():
        SearchPurchase()

    def delete():
        DeletePurchase()

    def count():
        CountPurchase()

    def returnn():
        admin_purchase_screen.destroy()

    menu_employ = Menu(admin_purchase_screen)
    menu_employ.add_command(label='添加', command=add)
    menu_employ.add_command(label='修改', command=amend)
    menu_employ.add_command(label='查询', command=search)
    menu_employ.add_command(label='删除', command=delete)
    menu_employ.add_command(label='统计', command=count)
    menu_employ.add_command(label='返回', command=returnn)

    admin_purchase_screen.config(menu=menu_employ)

    admin_purchase_screen.mainloop()


if __name__ == '__main__':
    PurchasePage()